﻿<navigation:Page x:Class="SoftwareLogistics.SharepointClient.Silverlight.Views.Main" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:my="clr-namespace:SoftwareLogistics.SharepointClient.Controls;assembly=SoftwareLogistics.SharepointClient.Library"                 
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Main Page" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
           xmlns:my1="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html">
    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <Style TargetType="StackPanel" x:Key="FilterContainer">
                <Setter Property="Height" Value="24" />
                <Setter Property="Margin" Value="5,0,5,0" />
                <Setter Property="VerticalAlignment" Value="Top" />
            </Style>
            <Style TargetType="ComboBox" >
                <Setter Property="Width" Value="200" />
                <Setter Property="DisplayMemberPath" Value="Name" />
            </Style>
            <Style TargetType="ListBox">
                <Setter Property="Margin" Value="5,30,5,5" />
            </Style>
            <Style TargetType="ListBoxItem">
                <Setter Property="BorderBrush" Value="Black" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="Background" Value="#f0f0f0" />
                <Setter Property="Margin" Value="4,0,4,4" />
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="50*" />
            <RowDefinition Height="50*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Horizontal" Grid.Column="1" Style="{StaticResource FilterContainer}" >
            <TextBlock Text="Time: " Foreground="White" FontWeight="Bold" />
            <ComboBox x:Name="TimeFilters" SelectionChanged="Filter_SelectionChanged" Tag="Time" DisplayMemberPath="Name" Width="200" />
        </StackPanel>
        
        <ListBox x:Name="TimeList" SelectionChanged="Row_SelectionChanged" Grid.Column="1" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <StackPanel>
                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Title" FontSize="14" FontWeight="Bold" />
                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Task" FormatType="LinkedRecord" FontSize="13" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="by: " Foreground="{StaticResource ForegroundBrush}" />
                                <my:GridTextBlock Field="{Binding Columns}" FieldName="User" FormatType="User" Width="120" />
                                <TextBlock Text="date: " Foreground="{StaticResource ForegroundBrush}" />
                                <my:GridTextBlock Field="{Binding Columns}" FieldName="Work Date" FormatType="Date" Width="80" />
                                <TextBlock Text="hours: " Foreground="{StaticResource ForegroundBrush}" />
                                <my:GridTextBlock Field="{Binding Columns}" FieldName="Hours Worked" FormatType="Hours" Width="80" />
                            </StackPanel>

                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Orientation="Horizontal" Style="{StaticResource FilterContainer}" >
            <TextBlock Text="Tasks: " Foreground="White" FontWeight="Bold" />
            <ComboBox x:Name="TaskFilters" SelectionChanged="Filter_SelectionChanged" Tag="Tasks" />
        </StackPanel>
        <ListBox x:Name="TasksList" SelectionChanged="Row_SelectionChanged" Grid.Column="0" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Stretch">
                        <Grid.RowDefinitions>
                            <RowDefinition  />
                            <RowDefinition  />
                            <RowDefinition  />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="30" />
                        </Grid.ColumnDefinitions>
                        <my:GridTextBlock Field="{Binding Columns}" FieldName="Title" FontSize="14" FontWeight="Bold" Grid.Row="0" />
                        <my:GridTextBlock Field="{Binding Columns}" FieldName="Project" FormatType="LinkedRecord" Grid.Row="1" FontSize="13" />
                        <StackPanel Orientation="Horizontal" Grid.Row="2" >
                            <TextBlock Text="assigned: " Foreground="{StaticResource ForegroundBrush}"/>
                            <my:GridTextBlock Field="{Binding Columns}" FieldName="AssignedTo" FormatType="User" Width="140" />
                            <TextBlock Text="priority: " Foreground="{StaticResource ForegroundBrush}"/>
                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Status" Width="100" />
                        </StackPanel>
                        <Image Cursor="Hand" Source="/Images/addtime.png" Grid.RowSpan="2" Grid.Column="1" x:Name="AddTimeButton" MouseLeftButtonDown="AddTimeButton_MouseLeftButtonUp" Tag="{Binding}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Orientation="Horizontal" Style="{StaticResource FilterContainer}" Grid.Row="1" Grid.Column="0" >
            <TextBlock Text="Project: " Foreground="White" FontWeight="Bold" />
            <ComboBox x:Name="ProjectFilter" Grid.Row="1" SelectionChanged="Filter_SelectionChanged" Tag="Project" />
        </StackPanel>
        <ListBox x:Name="ProjectList" SelectionChanged="Row_SelectionChanged" Grid.Column="0" Grid.Row="1"  >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition  />
                            <RowDefinition  />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="30" />
                        </Grid.ColumnDefinitions>
                        <my:GridTextBlock Field="{Binding Columns}" FieldName="Title" FontSize="14" FontWeight="Bold" />
                        <Image Source="/Images/addtask.png"  Grid.Column="1" x:Name="AddTaskButton" MouseLeftButtonDown="AddTaskButton_MouseLeftButtonUp"  Tag="{Binding}" Grid.RowSpan="2" Cursor="Hand"/>
                        <StackPanel Orientation="Horizontal" Grid.Row="1" >
                            <TextBlock Text="portfolio: " Foreground="{StaticResource ForegroundBrush}"/>
                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Portfolio" FormatType="User" Width="140" />
                            <TextBlock Text="status: " Foreground="{StaticResource ForegroundBrush}"/>
                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Status" Width="100" />
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</navigation:Page>
